package app.kotlin_1.adapter

import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter

/**
 * Created by 刘智强 on 2017/9/25.
 */
 class  DataFragmentAdapter : FragmentPagerAdapter {

    var titles:Array<String>?=null
    var fragmentList= mutableListOf<Fragment>()

    constructor(fm: FragmentManager?, titles: Array<String>?, fragmentList: MutableList<Fragment>) : super(fm) {
        this.titles = titles
        this.fragmentList = fragmentList
    }
    override fun getItem(position: Int): Fragment =fragmentList[position]

    override fun getCount(): Int =fragmentList.size

    override fun getPageTitle(position: Int): CharSequence =titles!![position]

}